<?php
class Student
{
  private $id;
  private $name;
  private $brith;
  private $gender;

//构造函数
  public function __construct($id,$name,$age,$gender){
      
      $this->setId($id);
      $this->setName($name);
      $this->setAge($age);
      $this->setGender($gender);
    
  }
  public  function getId(){
  	return  $this->id;
  }
  public function setId($id){
      if (is_integer($id)) {
      	$this->id=$id;
      }
  }
  public function getName(){
    return $this->name;
  }
  public function setName($name){
   if (is_string($name)) {
   	$this->name=$name;
   }

  }
  public function getGender(){
     return $this->gender==1?'男':'女';
  }
  public function setGender($gender){
    if (is_integer($gender)) {
    	$this->gender=$gender;
    }
  }
  public function setAge($age){
  	if (is_integer($age)) {
  		$this->brith=time()-$age*365*24*3600;
  	}
  }
  public function getBrith(){
  	return date('Y-m-d',$this->brith);
  }
  public function printInfo(){
  	echo 'id'.$this->getId().'姓名：'.$this->getName().'出生日期：'.$this->getBrith().'性别'.$this->getGender();
  }

}